package com.gx.smart.building.ui.repair.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.recyclerview.widget.RecyclerView;

import com.gx.smart.base.BaseAdapter;
import com.gx.smart.building.R;
import com.gx.smart.building.databinding.ItemSearchPersonLayoutBinding;
import com.huishi.gx.ib.grpc.lib.ib.app.sysuser.v1.SysUserDto;

/**
 * @author: xiaosy
 * 时间: 2022/3/29
 * @Description: java类作用描述
 * @Version: 1.0
 **/
public class RepairSearchPersonAdapter extends BaseAdapter<SysUserDto, RepairSearchPersonAdapter.ViewHolder> {
    public RepairSearchPersonAdapter(Context context) {
        super(context);
    }

    @Override
    protected int onBindLayout() {
        return R.layout.item_search_person_layout;
    }

    @Override
    protected ViewHolder onCreateHolder(View view) {
        ItemSearchPersonLayoutBinding binding = ItemSearchPersonLayoutBinding.inflate(LayoutInflater.from(mContext),
                (ViewGroup) view, false);
        return new ViewHolder(binding);
    }

    @Override
    protected void onBindData(ViewHolder holder, SysUserDto item, int position) {
        holder.binding.person.setText(item.getName());
    }

    protected static class ViewHolder extends RecyclerView.ViewHolder {
        private final ItemSearchPersonLayoutBinding binding;

        public ViewHolder(ItemSearchPersonLayoutBinding binding) {
            super(binding.getRoot());
            this.binding = binding;
        }
    }
}
